<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 数组 </title>
</head>
<body>
<h2>访问最后一个数组元素</h2>

<p id="demo"></p>

<script>
  var fruits = ["Banana", "Orange", "Apple", "Mango"];
  var last = fruits[fruits.length-1];
  document.getElementById("demo").innerHTML = last;
</script>

</body>
</html>

<!--Mango-->